例2.2 に、 DriverManager を使用してデモ・データ・ストアへの直接ドライバ接続を作成し、SQLを実行して、接続をクローズするアプリケーションの一般的なフレームワークを示します。処理の例については、level1.java
デモを参照してください。
String URL = "jdbc:timesten:dsn=demo";
Connection con = null;
try {
Class.forName("com.timesten.jdbc.TimesTenDriver");
} catch (ClassNotFoundException ex) {
// See "Handling Errors"
}
try {
// Open a connection to TimesTen
con = DriverManager.getConnection(URL);
// Report any SQLWarnings on the connection
// See "Reporting errors and warnings"
// Do SQL operations
// See "Managing TimesTen Data"
// Close the connection to TimesTen
con.close();
// Handle any errors
} catch (SQLException ex) {
// See "Handling Errors"
}